package is.sclab.datastore;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@SuppressWarnings("serial")
@PersistenceCapable(identityType = IdentityType.APPLICATION,detachable="true")
public class DataStore implements Serializable{

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	@Persistent
	private String name;
	@Persistent
	private String data;
	@Persistent
	private Date date;

	public DataStore(String name, String data) {
		this.name = name;
		this.data = data;
		this.date = Calendar.getInstance().getTime();
	}
	
	public String RetrieveData (){
		return "name="+this.name+" data="+data+" "+id;//this.data or data, either is OK 
	}
	
    public Long getId() { 
        return id; 
    } 

    public String getName() { 
        return name; 
    } 

    public String getData() { 
        return data; 
    } 
    
    public Date getDate() { 
        return date; 
    } 


}
